<?php
/*****************************************************************************
*@author:HW
*Email:phamhung.ktxclc@gmail.com
******************************************************************************/

function AuctionTheme_watch_list_area_function()
{
	
	
	global $current_user;
	get_currentuserinfo();
	$uid = $current_user->ID;
	
	
	?>
    <div id="content">
    
    		<div class="my_box3" >
                <div class="padd10">
                        
                <div class="box_title"><?php echo __("Watch List", 'AuctionTheme'); ?></div>
                <div class="box_content">
    				
                    
                                <?php
				
				
				global $wpdb;
				$s = "select * from ".$wpdb->prefix."auction_watchlist where uid='$uid' order by id asc";	
				$r = $wpdb->get_results($s);

				$my_arr = array();
					
				if(count($r) > 0)
				foreach($r as $item)
				{
					$my_arr[] = $item->pid;	
				}					
				
				if(count($my_arr) == 0) $my_arr[0] = 0;		
				
				$args = array('post__in' => $my_arr,
				'post_type' 	=> 'auction', 
				'paged'			=> $wp_query->query_vars['paged']);
				
				$the_query = new WP_Query( $args );				
				
				if($the_query->have_posts()):
				// The Loop
				while ( $the_query->have_posts() ) : $the_query->the_post();
				
					auctionTheme_get_post();
					
				endwhile;
				
				if(function_exists('wp_pagenavi')):
		
					echo '<div class="navi-wrap">';
					wp_pagenavi( array( 'query' => $the_query ) );
					echo '</div>';
				
				endif;
				
				else:
					_e('There are no auctions in your watch list.','AuctionTheme');
				endif;
				
				// Reset Post Data
				wp_reset_postdata();
								
				?>
                
                
                </div>
                </div>
            </div>
                
    
    </div>
    
    
    <!-- ################ -->
    
    <div id="right-sidebar">
    <ul class="xoxo">
        <?php dynamic_sidebar( 'other-page-area' ); ?>
    </ul>
    </div>
    
    <?php
	
}

?>